package com.test;

import com.web.startup.CustomSecurityConfig;
import com.web.startup.HibernateConfig;
import com.web.startup.SpringMvcConfig;
import com.web.startup.WebStartupInitializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import org.testng.annotations.BeforeMethod;

/**
 * Created with IntelliJ IDEA.
 * User: lxf
 * Date: 2016/12/15
 * Time: 9:59
 * To change this template use Editor | File and Code Templates.
 */
@WebAppConfiguration
@ContextConfiguration(classes = {WebStartupInitializer.class, SpringMvcConfig.class, CustomSecurityConfig.class, HibernateConfig.class})
public class BaseTestConfigurationWithTransaction extends AbstractTransactionalTestNGSpringContextTests {

    @Autowired
    protected WebApplicationContext wac;
    protected MockMvc mockMvc;

    @BeforeMethod
    public void startup() {
        mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
    }

}
